Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

added ipfs.ls test spec #150

Closed
wants to merge 2 commits into from
Closed

Conversation

fazo96
Copy link

@fazo96 fazo96 commented Nov 25, 2015

While working with the API I noticed weird behavior in ipfs.ls. Sometimes it calls the callback twice and some other times when there's an error the error object is undefined and the response object is the actual error.

After talking briefly with @dignifiedquire I've been trying to write tests to test these and also normal ipfs.ls functionality. Please let me know about anything wrong with the PR 👍

Looks like I couldn't reproduce the issue I was having. I'll try again if I happen to run into it, but it was probably some mistake on my end.

@fazo96 fazo96 changed the title WIP: added ipfs.ls test spec added ipfs.ls test spec Nov 26, 2015
if (err) {
throw err
}

daemon.add('test/test-folder', {r: true}, (e, r) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This folder is added too during the add tests, could you use the hash from there?

@daviddias
Copy link
Contributor

Thank you @fazo96 :)

I had in my memory that we had ls tests, in fact, it was always our sluggish test, but I see that with the refactoring, it was lost (//cc @dignifiedquire ). You can find the old test here: https://github.com/ipfs/js-ipfs-api/blob/bdf2e38ec233707d16c6fbd55ce878cb91be1987/test/tests.js#L178-L230 . Your tests are more complete, it could only also confirm that all of the links returned are the ones expected, would you mind adding that?

Thank you!

})
it('should correctly handle a nonexisting hash', function (done) {
apiClients['a'].ls('surelynotavalidhashheh?', (err, res) => {
if (err !== null && res === undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We since switched to expect, so you can do something like

expect(err).to.exist
expect(res).to.not.exist

@dignifiedquire
Copy link
Contributor

Upps sorry for removing the ls tests :(

@fazo96
Copy link
Author

fazo96 commented Dec 18, 2015

Will fix it soon 👍 Thanks!

@daviddias
Copy link
Contributor

@fazo96 still update to do the last changes so that we can merge this PR? Thank you :)

dignifiedquire added a commit that referenced this pull request Jan 22, 2016
Based on the work in #150.

Closes #150.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants